/*
 * SocketServer.cpp
 *
 *  PEREIRA, FERNANDO ROQUE
 *  91610
 */

#include "SocketServer.h"

int SocketServer::escucharPuerto(unsigned int maxClientes) {
	// TODO: REUSEADDRESS! con setsockopt()
	int retorno = bind(this->sockFd, (struct sockaddr*)&(this->sockAddr),
			sizeof(struct sockaddr));
	if (retorno == -1) {return -1;}
	return (listen(this->sockFd, maxClientes));
}

int SocketServer::aceptarCliente(struct sockaddr_in clienteAddr,
	unsigned int clienteLen) {
	return (accept(this->sockFd, (struct sockaddr*)&clienteAddr, &clienteLen));
}
